<?php

    /**
     * Install
     *
     * @package      Core
     * @subpackage   Installer_Adapter
     *
     * @license      GNU Lesser General Public Licence see LICENCE-LGPL file or http://www.gnu.org/licenses/lgpl.html
     */
	class Core_Installer_Adapter_Wsupdater implements Core_Installer_Adapter_Interface
	{

	////////////////////////////////////////////////////////////////////////////
	//                                 Methods                                //
	////////////////////////////////////////////////////////////////////////////

        /**
         * Processes
         *
         * @param       array       $data
         * @return      string
         */
        public function process(array $data)
        {
        	$server    = $_SERVER['SERVER_NAME'];
        	$baseUrl   = "http://".$server.$data['basePath'];
        	
        	return
"<?xml version ='1.0' encoding ='UTF-8' ?> 
<definitions name='Updater' 
    targetNamespace='".$baseUrl."project/app/var/config/updater.wsdl' 
    xmlns:tns='".$baseUrl."project/app/var/config/updater.wsdl' 
    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
    xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
    xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' 
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
    xmlns='http://schemas.xmlsoap.org/wsdl/'> 

    <message name='sendParams'> 
        <part name='params' type='xsd:array'/> 
    </message> 
    <message name='getResponse'> 
        <part name='response' type='xsd:array'/> 
    </message> 

    <portType name='UpdaterPortType'> 
        <operation name='getCurrentVersionEntry'> 
            <input message='tns:sendParams'/> 
            <output message='tns:getResponse'/> 
        </operation> 
        <operation name='migrateEntry'> 
            <input message='tns:sendParams'/> 
            <output message='tns:getResponse'/> 
        </operation> 
    </portType> 

    <binding name='UpdaterBinding' type='tns:UpdaterPortType'> 
        <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> 
        <operation name='getCurrentVersionEntry'> 
            <soap:operation soapAction='urn:".$server."-updater#getCurrentVersionEntry'/> 
            <input> 
                <soap:body use='encoded' namespace='urn:".$server."-updater' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
            </input> 
            <output> 
                <soap:body use='encoded' namespace='urn:".$server."-updater' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
            </output> 
        </operation> 
        <operation name='migrateEntry'> 
            <soap:operation soapAction='urn:".$server."-updater#migrateEntry'/> 
            <input> 
                <soap:body use='encoded' namespace='urn:".$server."-updater' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
            </input> 
            <output> 
                <soap:body use='encoded' namespace='urn:".$server."-updater' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
            </output> 
        </operation> 
    </binding>

    <service name='UpdaterService'> 
        <port name='UpdaterPort' binding='UpdaterBinding'> 
            <soap:address location='".$baseUrl."serum/updater/webservice.php'/> 
        </port> 
    </service>
</definitions>";
        }
	}
